package business.impl;

import java.sql.ResultSet;
import java.util.List;

import model.TPractice;
import model.Tteachclass;
import model.VStuachi;
import model.VStuexpe;
import model.Vteacherclass;
import business.basic.iHibBaseDAO;
import business.basic.iHibBaseDAOImpl;
import business.dao.TeachclassDao;

public class TeachclassDapImpl implements TeachclassDao {
	
	
	iHibBaseDAO bdao = null;
	public void setBdao (iHibBaseDAO bdao){
		this.bdao=bdao;
		
	}

	@Override
	public Tteachclass getclassById(int id) {
		Tteachclass title = (Tteachclass) bdao.findById(Tteachclass.class,id);
		return title;
	}

	@Override
	public int addClass(Tteachclass model) {
		Object obj = bdao.insert(model);
		if (obj == null) {
			return 0;
		}
		return 1;
	}

	@Override
	public boolean upClass(Tteachclass model) {
		return bdao.update(model);
	}

	@Override
	public boolean delClass(int id) {
		return bdao.delete(Tteachclass.class, id);
	}

	@Override
	public List<Vteacherclass> getlist() {
		String sql = " from Vteacherclass   ";
		List<Vteacherclass> modl = bdao.select(sql);
		return modl;
	}

	@Override
	public List<Vteacherclass> getlistbyid(int id) {
		String sql = " from Vteacherclass where teacherid =   ?";
		Object[] para = {id};
		List<Vteacherclass> modl = bdao.select(sql, para);
		return modl;
	}

}
